import Mock from 'mockjs'

// 连接率分布数据
export const mockRateDistribution = () => {
  Mock.mock(/\/api\/data\/rate\/distribution/, 'get', (options) => {
    return {
      code: 200,
      message: 'success',
      data: {
        success: [
          { longitude: 116.46, latitude: 39.92 },
          { longitude: 121.48, latitude: 31.22 },
          { longitude: 113.23, latitude: 23.16 },
        ],
        failure: [
          { longitude: 120.13, latitude: 30.23 },
          { longitude: 108.95, latitude: 34.27 },
        ]
      }
    }
  })
}

// APP流量跟踪数据
export const mockRateStatistic = () => {
  Mock.mock(/\/api\/data\/statistic/, 'get', (options) => {
    // 解析 URL 参数
    const url = new URL(options.url, window.location.origin)
    const params = Object.fromEntries(url.searchParams)

    // 这里可以使用参数来模拟不同的数据场景
    return {
      code: 200,
      message: 'success',
      data: {
        xaxisData: ['CMCC', 'CUCC', 'CTCC'],
        seriesData: [120, 200, 150],
      },
    }
  })
}
